#!/usr/bin/python3
# -*- coding:utf-8 -*-
"""
@author: 
@time: 2024/4/17 12:18 AM
@Function: 请输入模块功能描述
"""
from playwright.sync_api import Playwright, sync_playwright, expect


def run(playwright: Playwright) -> None:
    browser = playwright.chromium.launch(headless = False)
    context = browser.new_context()

    context.tracing.start(screenshots = True, snapshots = True, sources = True)

    page = context.new_page()
    page.goto("https://xbasetest.dxbim.com:18899/user/login")

    page.locator("//*[@id='login_userName']").fill("18516700021")
    page.locator("//*[@id='login_password']").fill("qhdia111")
    page.locator("//button[@type='submit']").click()

    context.tracing.stop(path = "trace.zip")
    # ---------------------
    context.close()
    browser.close()


with sync_playwright() as playwright:
    run(playwright)


"""
python3 example7.py
playwright show-trace trace.zip
"""